{include file='public/_meta'}
<title>前台列表</title>
</head>
<body>
<nav class=""><a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form class="Huiform" method="post" action="{:url('admin/cjgl/printcb')}" target="_self">
		<div class="text-c"> 按出殡日期检索：
			<input type="text" onfocus="WdatePicker({ maxDate:'#F{ $dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" value="{$datemin}" id="datemin" name="datemin" class="input-text Wdate" style="width:120px;">
			-
			<input type="text" onfocus="WdatePicker({ minDate:'#F{ $dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" value="{$datemax}" id="datemax" name="datemax" class="input-text Wdate" style="width:120px;">
			<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜订单信息</button>
		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20" style="margin-bottom: 10px;"> 
		<span class="l">
			<a href="javascript:;" onclick="admin_printcb('打印出殡订单')" class="btn btn-success radius"><i class="Hui-iconfont">&#xe627;</i> 打印出殡订单</a>
		</span>
		<span class="r">共有数据：<strong>{$totalcounts}</strong> 条</span>
	</div>
	<table id="listTable" class="table table-border table-bordered table-bg table-sort display">
		<thead>
			<tr>
				<th scope="col" colspan="11">订单列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="100">出殡日期</th>
				<th width="60">房间号</th>
				<th width="70">逝者姓名</th>
				<th width="40">性别</th>
				<th width="50">年龄</th>
				<th>火化炉</th>
				<th width="40">炉次</th>
				<th>告别厅</th>
				<th width="80">登记部门</th>
				<th>登记日期</th>
			</tr>
		</thead>
		<tbody>
			{if $list}
			{foreach $list as $k=>$v}
			<tr class="text-c">

				<td>{$v.id}</td>
				<td>{$v.cbrq|date="Y-m-d",###}</td>
				<td>{$v.cs_fjid}</td>
				<td>{$v.xm}</td>
				<td>{$v.xb}</td>
				<td>{$v.nl}</td>
				<td>{$v.ydl}</td>
				<td>{$v.ydlc}</td>
				<td>{$v.gbt}</td>
				<td class="td-status"><span class="label {if $v.djbz==0}label-primary{/if}{if $v.djbz==1}label-secondary{/if}{if $v.djbz==2}label-success{/if} radius">{if $v.djbz==0}前台{/if}{if $v.djbz==1}车间{/if}{if $v.djbz==2}尸检所{/if}</span></td>
				<td>{$v.djrq}</td>

			</tr>
			{/foreach}
			{else}
			<tr class="text-c">
				<td colspan="11">暂无信息</td>
			</tr>
			{/if}
		</tbody>
	</table>
</div>
<div style="display: none;" id="printBox"></div>
<!--_footer 作为公共模版分离出去-->
{include file='public/_footer'}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="__PUBLIC__lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
	var t;
    $(document).ready(function(){
        //不显示任何错误信息
        $.fn.dataTable.ext.errMode = 'none';
        t = $('#listTable').dataTable({
			"bStateSave": false,//状态保存
            "paging": false,
            "searching":false,
            "lengthChange":false,
            "info":false,
            "ordering":  false
		});

		$('#listTable tbody').on( 'click', 'tr', function () {
			if ( $(this).hasClass('selected') ) {
				$(this).removeClass('selected');
			} else {
				$('#listTable tbody tr.selected').removeClass('selected');
				$(this).addClass('selected');
			}
		} );
	});
	// 打印出殡列表信息
    function admin_printcb(title){
        var datemin = document.getElementById('datemin').value;
        var datemax = document.getElementById('datemax').value;
        $.getJSON("{:url('admin/cjgl/printcbdo')}",{'datemin':datemin,'datemax':datemax},function(res){
            //alert(res.data);
			document.getElementById('printBox').innerHTML = res.data;
            preview(1);
		});
	}

    function printxm(oper){
        preview(oper);
    }

    function preview(oper){
        if (oper < 10){
            bdhtml=window.document.body.innerHTML;      //获取当前页的html代码
            sprnstr="<!--startprint"+oper+"-->";        //设置打印开始区域
            eprnstr="<!--endprint"+oper+"-->";          //设置打印结束区域
            prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
            prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //从结束代码向前取html
            window.document.body.innerHTML=prnhtml;
            window.print();
            window.document.body.innerHTML=bdhtml;
        } else {
            window.print();
        }
    }

</script>
</body>
</html>